{% macro render_pagination(pagination, endpoint) %}
    {% if pagination.pages > 0 %}
    <div class="pages">
        <div class="plist">
            <ul>
                <li><a href='{% if not pagination.has_prev %} # {%else%} {{url_for(endpoint, page=pagination.prev_num)}} {% endif %}'>上一页</a></li>
                {% for page in pagination.iter_pages() %}
                    {% if page != pagination.page %}
                        <li><a href="{{ url_for(endpoint, page=page) }}">{{ page }}</a></li>
                    {% else %}
                        <li class="thisclass"><a href="#" style="color: #fff;">{{ page }}</a></li>
                    {% endif %}
                {% endfor %}
                <li><a href='{% if not pagination.has_next %} # {% else %} {{url_for(endpoint, page=pagination.next_num)}} {% endif %}'>下一页</a></li>
                <li><a href='{{url_for(endpoint, page=pagination.pages)}}'>末页</a></li>
            </ul>
        </div>
    </div>
    {% endif %}
{% endmacro %}